package com.aqie.demo.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

/**
 * @Author aqie
 * @Date 2021/12/9 9:31
 * @desc
 */
public class PropertyUtils {
    public static String getProperties(String keyWord) {
        InputStream is = PropertyUtils.class.getClassLoader().getResourceAsStream("application.yml");
        assert is != null;
        BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
        Properties properties = new Properties();
        try {
            properties.load(br);
            return properties.getProperty(keyWord);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
